import React from "react";
import { Divider, Button, Timeline, Modal, Layout } from "antd/lib";
import Workflow from "@/services/workflow";

function getDatas(items)
{
  let element;
    if (items.organizationname === "成都市第六⼈⺠医院") {
      element = '<div><h2 align="center"> ' + items.organizationname + '经济合同审签表</h2>';
      element = element + '<div style="text-align:center">';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt"><td>';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="2"><p align="center"><span >合同名称</span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >'
      let i;
      for (i = 0; i <= Math.ceil(items.name.length / 20); i++) {
        if (i > 0) {
          element = element + '<br/>';
        }
        element = element + items.name.substr(i * 20, 20);
      }
      element = element + '</span></p></td>';
      element = element + '<td colspan="2"><p align="center"><span >合同编码</span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >' + items.officialcode + '</span></p></td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td>';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="2"><p align="center"><span >合同甲方</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >' + items.organizationname + '</span></p></td>';
      element = element + '<td colspan="2"><p align="center"><span >联系电话</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >13881899393</span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:25.7pt">';
      element = element + '<td colspan="2"><p align="center"><span >合同乙方</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >' + items.party_aname + '</span></p></td>';
      element = element + '<td colspan="2"><p align="center"><span >联系电话</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >' + items.party_mobile + '</span></p></td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '<tr style="height:25.7pt">';

      element = element + '<td>';
      element = element + '<table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="1"><p align="center"><span >合同类型</span></p></td>';
      element = element + '<td colspan="7">';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:580pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >总价合同<input type="checkbox" ' + (items.pricetype === 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >合同金额（小写：¥' + (items.pricetype === 0 ? items.amount : 0) + ' 大写：' + (items.pricetype === 0 ? items.amount_words : "") + ' )</span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >单价合同<input type="checkbox" ' + (items.pricetype !== 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >单价金额：                                                 按合同单价据实结算</span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >费率合同<input type="checkbox" ></span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >费率：                                                    按合同费率据实结算</span></p></td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td>';
      element = element + '<table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="1"><p align="center"><span >合同类别</span></p></td>';
      element = element + '<td colspan="7">';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:580pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >购置货物</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >固定资产<input type="checkbox" ' + (items.contracttype.indexOf('固定资产') >= 0 ? 'checked="checked"' : '') + '>  卫材<input type="checkbox" ' + (items.contracttype.indexOf('卫材') >= 0 ? 'checked="checked"' : '') + '> 后勤物资<input type="checkbox" ' + (items.contracttype.indexOf('后勤物资') >= 0 ? 'checked="checked"' : '') + '> 其他物资<input type="checkbox" ' + (items.contracttype.indexOf('其他物资') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >租   赁</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >出租<input type="checkbox" ' + (items.contracttype.indexOf('出租') >= 0 ? 'checked="checked"' : '') + '>  承租<input type="checkbox" ' + (items.contracttype.indexOf('承租') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >购买服务</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >后勤服务<input type="checkbox" ' + (items.contracttype.indexOf('后勤服务') >= 0 ? 'checked="checked"' : '') + '>  设备维修维保<input type="checkbox" ' + (items.contracttype.indexOf('设备维修维保') >= 0 ? 'checked="checked"' : '') + '> 宣传<input type="checkbox" ' + (items.contracttype.indexOf('宣传') >= 0 ? 'checked="checked"' : '') + '> 其他服务<input type="checkbox" ' + (items.contracttype.indexOf('其他服务') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >捐   赠</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >接受捐赠<input type="checkbox" ' + (items.contracttype.indexOf('接受捐赠') >= 0 ? 'checked="checked"' : '') + '>  对外捐赠<input type="checkbox" ' + (items.contracttype.indexOf('对外捐赠') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >基建项目</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >基本建设<input type="checkbox" ' + (items.contracttype.indexOf('基本建设') >= 0 ? 'checked="checked"' : '') + '>  维修改造<input type="checkbox" ' + (items.contracttype.indexOf('维修改造') >= 0 ? 'checked="checked"' : '') + '> 建设服务<input type="checkbox" ' + (items.contracttype.indexOf('建设服务') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >科研教学</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >科研课题<input type="checkbox" ' + (items.contracttype.indexOf('科研课题') >= 0 ? 'checked="checked"' : '') + '>  GCP<input type="checkbox" ' + (items.contracttype.indexOf('GCP') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >信 息 化</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >硬件<input type="checkbox" ' + (items.contracttype.indexOf('硬件') >= 0 ? 'checked="checked"' : '') + '>  软件<input type="checkbox" ' + (items.contracttype.indexOf('软件') >= 0 ? 'checked="checked"' : '') + '> 信息服务<input type="checkbox" ' + (items.contracttype.indexOf('信息服务') >= 0 ? 'checked="checked"' : '') + '> </span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >承    包</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >承包<input type="checkbox" ' + (items.contracttype.indexOf('承包') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="3" ><p align="center"><span >对外合作</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >无偿合作<input type="checkbox" ' + (items.contracttype.indexOf('无偿合作') >= 0 ? 'checked="checked"' : '') + '>  有偿合作<input type="checkbox" ' + (items.contracttype.indexOf('有偿合作') >= 0 ? 'checked="checked"' : '') + '> </span></p></td>';
      element = element + '<td colspan="3" ><p align="center"><span >其    他</span></p></td>';
      element = element + '<td colspan="3" ><p align="left"><span >其他<input type="checkbox" ' + (items.contracttype.indexOf('其他') >= 0 ? 'checked="checked"' : '') + '></span></p></td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="2"><p align="left"><span >摘要：' + items.message + '</span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="2"><p align="left"><span >审签意见</span></p></td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td>';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td colspan="2"><p align="center"><span >合同经办人</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >' + items.employeename + '</span></p></td>';
      element = element + '<td colspan="2"><p align="center"><span >电话号码</span></p></td>';
      element = element + '<td colspan="2" ><p align="center"><span >无</span></p></td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '<tr style="height:32.7pt">';
      element = element + '<td>';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:600pt">';
      //if(!data){
        items.data.forEach(item => {
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >' + item.statename + '</span></p></td>';
        element = element + '<td  >';
        element = element + '<table  cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:500pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + item.opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px>';
        element = element + '<table  cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:500pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + item.username + '</td>';
        element = element + '<td width=150px><p align="center">' + item.updated_at + '</p></td>';
        element = element + '</tr>';
        element = element + '</table>';
        element = element + '</td>';
        element = element + '</tr>';
        element = element + '</table>';
        element = element + '</td>';
        element = element + '</tr>';
      });
      //}
      element = element + '</table>';
      element = element + '</td>';
      element = element + '</tr>';
      element = element + '</table>';
      element = element + '</div>';
      element = element + '</div>';
      this.setState({
        comments: element,
      });
    } else {
      element = '<table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:700pt">';
      element = element + '<tr height="40px">';
      element = element + '   <td >';
      element = element + '   <p align="left" width="50%" style="margin: 1px;">附件1</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="50px">';
      element = element + '   <td >';
      element = element + '<h2 align="center" > ' + items.organizationname + '合同签报表</h2>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr ><td>';
      element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:700pt">';
      element = element + '<tr height="40px">';
      element = element + '   <td >';
      element = element + '   <p align="left" width="50%" style="margin: 10px;">合同类别：' + items.contracttype + '</p>';
      element = element + ' </td>';
      element = element + ' <td >';
      element = element + '   <p align="left" style="margin: 10px;">合同编号：' + items.officialcode + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td colspan="2">';
      element = element + '   <p align="left" style="margin: 10px;">合同名称：' + items.name + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td rowspan="2">';
      element = element + '   <p align="left" width="50%" style="margin: 10px;">合同甲方：武汉科技大学附属天佑医院</p>';
      element = element + ' </td>';
      element = element + '   <td >';
      element = element + '   <p align="left" style="margin: 10px;">合同乙方：' + items.party_aname + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td >';
      element = element + '   <p align="left" style="margin: 10px;">第三方：' + items.party_bname + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td colspan="2">';
      element = element + '   <p align="left" style="margin: 10px;">合同形成过程：（包括项目立项、采购和招标、商务谈判、合同文本草案拟定等过程）</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      var msgheight=items.message/2;
      if(msgheight<200){
        msgheight=200;
      }
      element = element + '<tr height="'+msgheight+'px">';
      element = element + '   <td colspan="2">';
      element = element + '   <p align="left" style="height: '+msgheight+'px;margin: 10px;">合同重要条款：' + items.message + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td >';
      element = element + '   <p align="left" width="50%" style="margin: 10px;">授权代理人：' + items.empowerperson + '</p>';
      element = element + ' </td>';
      element = element + ' <td >';
      element = element + '   <p align="left" style="margin: 10px;">授权代理人职务：' + items.empowerduties + '</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '<tr height="40px">';
      element = element + '   <td colspan="2">';
      element = element + '   <p align="left"  width="50%" style="margin: 10px;">承办人：' + items.employeename + '</p>';
      element = element + ' </td>';
      element = element + ' </tr><tr height="50px"><td colspan="2"> ';
        element = element + '<table  border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:700pt">';
        element = element + '<tr >';
        element = element + '<td width=250px><p align="center"><span >承办部门负责人：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[0].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[0].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[0].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >医疗发展部负责人：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[1].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[1].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[1].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >财务部负责人：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[2].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[2].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[2].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >法律顾问：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[3].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[3].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[3].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >分管院领导：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[4].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[4].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[4].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=250px><p align="center"><span >法定代表人：</span></p></td>';
        element = element + '<td width=450px><table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:450pt">';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[5].opinion + '</td>';
        element = element + '</tr>';
        element = element + '<tr style="height:25.7pt">';
        element = element + '<td width=150px></td>';
        element = element + '<td width=150px>签名:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + items.data[5].username + '</td>';
        element = element + '<td width=150px><p align="center">' + items.data[5].updated_at + '</p></td>';
        element = element + '</tr></table></td></tr></table>';
        element = element + '</td></tr ></table>';
      element = element + '<table  border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto; width:700pt">';
      element = element + '<tr>';
      element = element + '<td colspan="2"><p align="left" style="margin: 10px;">说明：<br/>';
      element = element + ' 1、医疗发展部根据招标相关管理规定审核公开招标完成项目；财务部根据合同<br/>';
      element = element + ' 管理和财务管理相关规定审核把关；20万元以上合同需法律顾问审核把关。<br/>';
      element = element + ' 2．合同承办人按上表从左至右的顺序，依次报请相关领导会签，签名应可辩认、<br/>';
      element = element + ' 并签署时间。<br/>';
      element = element + ' 3.合同承办人按要求归档合同。</p>';
      element = element + ' </td>';
      element = element + '</tr>';
      element = element + '</table>';

      //console.log('element', element);
    }
  return element;
}

const Lookchecksqbdata = {
  getDatas,
};

export default Lookchecksqbdata;
